package com.holly.unit.table.controller;


import com.holly.unit.core.pojo.response.ResponseData;
import com.holly.unit.core.pojo.response.SuccessResponseData;
import com.holly.unit.scanner.api.annotation.ApiResource;
import com.holly.unit.scanner.api.annotation.GetResource;
import com.holly.unit.table.entity.TableColumns;
import com.holly.unit.table.service.TableColumnsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@ApiResource(name = "表格相关api")
@Api(tags = "表格相关api")
@Slf4j
public class TableController {


    @Autowired
    private TableColumnsService tableColumnsService;


    @GetResource(name = "示例方法", path = "/table/getTableColumns", requiredPermission = false, requiredLogin = false)
    public ResponseData getTableColumns(@ApiParam("模块") String action,
                                        @ApiParam("所属页") String tableOrView) {
        Map<String, Object> map = new HashMap<>();
        map.put("action", action);
        map.put("tableOrView", tableOrView);
        List<TableColumns> list = tableColumnsService.getColumns(map);
        return new SuccessResponseData(list);

    }


}
